package com.hxzy.framework.common.util;

import com.hxzy.framework.common.exception.ApiException;
import com.hxzy.framework.common.resp.R;
import com.hxzy.framework.common.resp.ResultCode;

/**
 * @Author wy
 * @Description TODO
 * @Date 2024/1/26 15:20
 * @Version 1.0
 */
public class ResultUtil {

    /**
     * 远程数据读取
     * @param r
     * @param <T>
     * @return
     */
    public static  <T> T remoteResult(R<T> r){
        if(ResultCode.SUCCESS.getCode()==r.getCode()){
            return r.getData();
        }
        throw new ApiException(r.getCode(),r.getMsg());
    }
}
